<template>
  <div class="container">
    <!-- 补打发票 -->
    <!-- 查询条件 -->
    <el-form :inline="true" class="tableSearchBox hasPrint" size="medium">
      <el-form-item label="类别：">
        <el-select v-model="search.type" placeholder="请选择类别">
          <el-option v-for="(item,index) in typeList" :key="index" :label="item.name" :value="item.id"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item v-if="search.type==1">
        <!-- 实际为水表编号查询 -->
        <el-input class="form_input" v-model="search.meterID" placeholder="请输入用户编号" clearable
          @keyup.enter.native="getSearchData"></el-input>
      </el-form-item>
      <el-form-item v-if="search.type==2">
        <el-input class="form_input" v-model="search.name" placeholder="请输入用户姓名" clearable
          @keyup.enter.native="getSearchData"></el-input>
      </el-form-item>
      <el-form-item v-if="search.type==3">
        <el-date-picker v-model="search.period" type="month" format="yyyy-MM" value-format="yyyy-MM" placeholder="选择账期"
          :editable="false"></el-date-picker>
      </el-form-item>
      <el-form-item v-if="search.type==4">
        <el-select v-model="search.cashier" clearable placeholder="请选择收费员">
          <el-option v-for="(item,index) in tollCollectorList" :key="index" :label="item.name" :value="item.name">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="getSearchData">查询</el-button>
      </el-form-item>
    </el-form>
    <!-- /查询条件 -->
    <PagesTable ref="child" :tableMaxHeight="tableHeight" :tableExportPrinting="true" :tableID="tableId"
      :isTableTitle="false" :tableTitle="tableTitle" :isIndex="true" :tableHeader="tableHeader" :tableData="tableData"
      :tableOperation="tableOperation" :tablePagination="tablePagination" @pageSize="pageSizeChange"
      @currentPage="currentPageChange" @pageOperation="handlePageOperation" @getTableAllData="getTableAllData" />
  </div>
</template>

<script>
  import PagesTable from "../../components/PagesTable.vue";
  var LODOP; //声明为全局变量
  export default {
    components: {
      PagesTable
    },
    data() {
      return {
        tableHeight: "",
        search: {
          //搜索条件
          type: 4,
          name: "",
          meterID: "",
          period: "",
          cashier: ""
        },
        typeList: [{
            id: 1,
            name: "用户编号"
          },
          {
            id: 2,
            name: "用户姓名"
          },
          {
            id: 3,
            name: "账期"
          },
          {
            id: 4,
            name: "收费员"
          }
        ],
        tollCollectorList: [{
            suid: 1,
            name: "石慧玲"
          },
          {
            suid: 2,
            name: "尚兰英"
          },
          {
            suid: 3,
            name: "王静婷"
          },
          {
            suid: 4,
            name: "郑 锋"
          }
        ],
        tableId: "invoiceRecord",
        tableTitle: "发票记录",
        tableHeader: [{
            name: "账单编号",
            mark: "meterReadingRecordID",
            fixed: "left"
          },
          {
            name: "账期",
            mark: "period",
            fixed: "left"
          },
          {
            // 实际为水表编号内容
            name: "用户编号",
            mark: "meterID",
            fixed: "left"
          },
          {
            name: "用户姓名",
            mark: "name",
            fixed: "left"
          },
          // {
          //   name: "手机号",
          //   mark: "phone",
          //   width: "105"
          // },
          {
            name: "上期底数",
            mark: "lastReadingValue"
          },
          {
            name: "本期底数",
            mark: "currReadingValue"
          },
          // {
          //   name: "抵扣水量",
          //   mark: "readingFromDepositWater"
          // },
          {
            name: "用水量",
            mark: "currWaterCount"
          },
          // {
          //   name: "预存水量",
          //   mark: "currDepositWater"
          // },
          {
            name: "水票费",
            mark: "billFee"
          },
          {
            name: "水资源税",
            mark: "tax"
          },
          {
            name: "污水费",
            mark: "effluentFee"
          },
          {
            name: "收费员",
            mark: "cashierName"
          },
          {
            name: "缴费方式",
            mark: "costTypeName",
            width: "85"
          },
          {
            name: "缴费时间",
            mark: "payTime",
            width: "160"
          },
          {
            name: "操作",
            mark: "",
            width: "165",
            fixed: "right"
          }
        ],
        tableOperation: [{
            name: "水费票",
            mark: "waterBill",
            icon: false
          },
          {
            name: "污水票",
            mark: "sewageBill",
            icon: false,
            disabled: true,
            conditionMark: "effluentFee",
            conditionNum: 0
          }
        ],
        tablePagination: {
          show: true,
          current: 1,
          size: 10,
          total: 0
        },
        tableData: [],
        searchAllParam: {},
        //票据的数据
        receipt_data: {}
      };
    },
    async mounted() {
      const self = this;
      // await self.getTollCollectorList();
      self.getSearchData();
    },
    beforeDestroy() {},
    created() {
      var self = this;
      var height = $(document).height() - 172 - 67 - 50;
      self.tableHeight = height + "";
    },
    methods: {
      async getTollCollectorList() {
        //收费员列表
        const self = this;
        var param = {
          rid: 4
          // rid: 3
        };
        await self.$axios.post("/service/bsSysuserInfoGet", param).then(res => {
          if (res.data.status === "success") {
            self.tollCollectorList = res.data.res;
            for (let i = 0; i < self.tollCollectorList.length; i++) {
              if (
                self.tollCollectorList[i].suid == sessionStorage.getItem("suid")
              ) {
                self.search.cashier = self.tollCollectorList[i].name;
                return false;
              }
            }
          } else {
            self.$message.error(res.data.res);
          }
        });
      },
      getSearchData() {
        const self = this;
        self.tableData = [];
        self.tablePagination.total = 0;
        self.tablePagination.current = 1;
        self.tablePagination.size = 10;
        self.handleTableData();
      },
      handleTableData() {
        const self = this;
        if (self.search.type == 1) {
          //通过用户编号查询（实际为水表编号查询）
          if (self.search.meterID) {
            self.tableTitle = "发票记录（用户编号：" + self.search.meterID + "）";
          } else {
            self.tableTitle = "发票记录";
          }
          var param = {
            pageNum: self.tablePagination.current,
            pageSize: self.tablePagination.size,
            meterID: self.search.meterID
          };
          self.searchAllParam = {
            meterID: self.search.meterID
          }
          self.getPayingReceiptList(param);
        } else if (self.search.type == 2) {
          //通过用户姓名查询
          if (self.search.name) {
            self.tableTitle = "发票记录（用户姓名：" + self.search.name + "）";
          } else {
            self.tableTitle = "发票记录";
          }
          var param = {
            pageNum: self.tablePagination.current,
            pageSize: self.tablePagination.size,
            meterUserName: self.search.name
          };
          self.searchAllParam = {
            meterUserName: self.search.name
          }
          self.getPayingReceiptList(param);
        } else if (self.search.type == 3) {
          //通过账期查询
          if (self.search.period) {
            self.tableTitle = "发票记录（账期：" + self.search.period + "）";
          } else {
            self.tableTitle = "发票记录";
          }
          var param = {
            pageNum: self.tablePagination.current,
            pageSize: self.tablePagination.size,
            period: self.search.period
          };
          self.searchAllParam = {
            period: self.search.period
          }
          self.getPayingReceiptList(param);
        } else if (self.search.type == 4) {
          //通过收费员查询
          if (self.search.cashier) {
            self.tableTitle = "发票记录（收费员：" + self.search.cashier + "）";
          } else {
            self.tableTitle = "发票记录";
          }
          var param = {
            pageNum: self.tablePagination.current,
            pageSize: self.tablePagination.size,
            cashier: self.search.cashier
          };
          self.searchAllParam = {
            cashier: self.search.cashier
          }
          self.getPayingReceiptList(param);
        }
      },
      getPayingReceiptList(param) {
        const self = this;
        // self.$axios
        //   .post("/service/bsMeterPayingReceiptInfoAllGet", param)
        //   .then(res => {
        //     if (res.data.status === "success") {
        self.tableData = [{
            "readerName": "\u767d\u6c38\u65b0",
            "oddMoney": 0.0,
            "meterPayingRecordID": 47602,
            "waterFee": 7.2,
            "volumeName": "\u8d22\u653f\u5c40\u897f",
            "tax": 0.0,
            "period": "202110",
            "inputTime": "2023-10-08 17:41:08",
            "waterRateName": "\u751f\u6d3b\u7528\u6c34",
            "comp2": 0.19,
            "amounter": "",
            "comp1": 6.26,
            "currMeterRealPaymentMoney": 9.0,
            "fromAccount": 0.0,
            "operator": "",
            "userPayingRecordID": 44848,
            "effluentBillStatus": 0,
            "realWaterFee": 7.2,
            "realPay": 9.0,
            "waterBillStatus": 0,
            "ladderFee": 0.0,
            "realLateFee": 0.0,
            "realPaymentMoney": 9.0,
            "billFee": 6.45,
            "other": "",
            "payMoney": 0.0,
            "meterPayingRecordStatus": 1,
            "meterID": 3525,
            "currGiveChange": 0.0,
            "effluentFee": 2.55,
            "currMeterRealPaymentMoneyOld": 9.0,
            "lrid": "",
            "realTax": 0.0,
            "inputer": "\u738b\u6811\u6797",
            "meterLastSurplus": 0.75,
            "waterRateID": 1,
            "meterReadingRecordID": 52619,
            "realWaterCount": 3,
            "meterCurrSurplus": 0.0,
            "cashierName": "\u738b\u6811\u6797",
            "costTypeName": "\u73b0\u91d1",
            "totalBillFee": 9.0,
            "payTime": "2023-10-08 17:41:18",
            "currReadingValue": 535,
            "currWaterCount": 3,
            "realOtherFee": 0.0,
            "billAndTax": 6.45,
            "name": "\u5218\u8363\u6e05",
            "currMeterRealPaymentMoenyWithoutSurplus": 9.75,
            "volumeID": 62,
            "lastReadingValue": 532,
            "realEffluentFee": 2.55,
            "currManner": "",
            "lateDays": 0
          },
          {
            "readerName": "\u767d\u6c38\u65b0",
            "oddMoney": 0.0,
            "meterPayingRecordID": 47601,
            "waterFee": 28.8,
            "volumeName": "\u8d22\u653f\u5c40\u897f",
            "tax": 0.0,
            "period": "202110",
            "inputTime": "2023-10-08 17:38:07",
            "waterRateName": "\u751f\u6d3b\u7528\u6c34",
            "comp2": 0.84,
            "amounter": "",
            "comp1": 27.96,
            "currMeterRealPaymentMoney": 39.0,
            "fromAccount": 0.0,
            "operator": "",
            "userPayingRecordID": 44847,
            "effluentBillStatus": 0,
            "realWaterFee": 28.8,
            "realPay": 39.0,
            "waterBillStatus": 0,
            "ladderFee": 0.0,
            "realLateFee": 0.0,
            "realPaymentMoney": 39.0,
            "billFee": 28.8,
            "other": "",
            "payMoney": 0.0,
            "meterPayingRecordStatus": 1,
            "meterID": 3524,
            "currGiveChange": 0.0,
            "effluentFee": 10.2,
            "currMeterRealPaymentMoneyOld": 39.0,
            "lrid": "",
            "realTax": 0.0,
            "inputer": "\u738b\u6811\u6797",
            "meterLastSurplus": 0.0,
            "waterRateID": 1,
            "meterReadingRecordID": 52618,
            "realWaterCount": 12,
            "meterCurrSurplus": 0.0,
            "cashierName": "\u738b\u6811\u6797",
            "costTypeName": "\u73b0\u91d1",
            "totalBillFee": 39.0,
            "payTime": "2023-10-08 17:40:12",
            "currReadingValue": 853,
            "currWaterCount": 12,
            "realOtherFee": 0.0,
            "billAndTax": 28.8,
            "name": "\u5f20\u6709\u4eae",
            "currMeterRealPaymentMoenyWithoutSurplus": 39.0,
            "volumeID": 62,
            "lastReadingValue": 841,
            "realEffluentFee": 10.2,
            "currManner": "",
            "lateDays": 0
          },
          {
            "readerName": "\u767d\u660e\u5e38",
            "oddMoney": 0.0,
            "meterPayingRecordID": 47599,
            "waterFee": 19.2,
            "volumeName": "\u767e\u5bb6\u5df7",
            "tax": 0.0,
            "period": "202107",
            "inputTime": "2023-07-19 16:54:16",
            "waterRateName": "\u751f\u6d3b\u7528\u6c34",
            "comp2": 0.56,
            "amounter": "",
            "comp1": 18.64,
            "currMeterRealPaymentMoney": 26.0,
            "fromAccount": 0.0,
            "operator": "",
            "userPayingRecordID": 44846,
            "effluentBillStatus": 1,
            "realWaterFee": 19.2,
            "realPay": 39.0,
            "waterBillStatus": 1,
            "ladderFee": 0.0,
            "realLateFee": 0.0,
            "realPaymentMoney": 39.0,
            "billFee": 19.2,
            "other": "",
            "payMoney": 0.0,
            "meterPayingRecordStatus": 1,
            "meterID": 204,
            "currGiveChange": 0.0,
            "effluentFee": 6.8,
            "currMeterRealPaymentMoneyOld": 26.0,
            "lrid": "",
            "realTax": 0.0,
            "inputer": "\u51af\u5a1c",
            "meterLastSurplus": 0.0,
            "waterRateID": 1,
            "meterReadingRecordID": 42430,
            "realWaterCount": 8,
            "meterCurrSurplus": 0.0,
            "cashierName": "\u738b\u6811\u6797",
            "costTypeName": "\u73b0\u91d1",
            "totalBillFee": 26.0,
            "payTime": "2023-09-30 16:53:18",
            "currReadingValue": 421,
            "currWaterCount": 8,
            "realOtherFee": 0.0,
            "billAndTax": 19.2,
            "name": "\u9648\u5efa\u8363",
            "currMeterRealPaymentMoenyWithoutSurplus": 26.0,
            "volumeID": 80,
            "lastReadingValue": 413,
            "realEffluentFee": 6.8,
            "currManner": "",
            "lateDays": 0
          },
          {
            "readerName": "\u767d\u660e\u5e38",
            "oddMoney": 0.0,
            "meterPayingRecordID": 47600,
            "waterFee": 9.6,
            "volumeName": "\u767e\u5bb6\u5df7",
            "tax": 0.0,
            "period": "202109",
            "inputTime": "2023-09-15 17:43:08",
            "waterRateName": "\u751f\u6d3b\u7528\u6c34",
            "comp2": 0.28,
            "amounter": "",
            "comp1": 9.32,
            "currMeterRealPaymentMoney": 13.0,
            "fromAccount": 0.0,
            "operator": "",
            "userPayingRecordID": 44846,
            "effluentBillStatus": 0,
            "realWaterFee": 9.6,
            "realPay": 39.0,
            "waterBillStatus": 1,
            "ladderFee": 0.0,
            "realLateFee": 0.0,
            "realPaymentMoney": 39.0,
            "billFee": 9.6,
            "other": "",
            "payMoney": 0.0,
            "meterPayingRecordStatus": 1,
            "meterID": 204,
            "currGiveChange": 0.0,
            "effluentFee": 3.4,
            "currMeterRealPaymentMoneyOld": 13.0,
            "lrid": "",
            "realTax": 0.0,
            "inputer": "\u51af\u5a1c",
            "meterLastSurplus": 0.0,
            "waterRateID": 1,
            "meterReadingRecordID": 51353,
            "realWaterCount": 4,
            "meterCurrSurplus": 0.0,
            "cashierName": "\u738b\u6811\u6797",
            "costTypeName": "\u73b0\u91d1",
            "totalBillFee": 13.0,
            "payTime": "2023-09-30 16:53:18",
            "currReadingValue": 425,
            "currWaterCount": 4,
            "realOtherFee": 0.0,
            "billAndTax": 9.6,
            "name": "\u9648\u5efa\u8363",
            "currMeterRealPaymentMoenyWithoutSurplus": 13.0,
            "volumeID": 80,
            "lastReadingValue": 421,
            "realEffluentFee": 3.4,
            "currManner": "",
            "lateDays": 0
          },
          {
            "readerName": "\u51af\u5a1c",
            "oddMoney": 0.0,
            "meterPayingRecordID": 47589,
            "waterFee": 96.0,
            "volumeName": "\u9633\u5174\u5e9c",
            "tax": 0.0,
            "period": "202109",
            "inputTime": "2023-09-26 17:30:25",
            "waterRateName": "\u751f\u6d3b\u7528\u6c34",
            "comp2": 2.8,
            "amounter": "\u51af\u5a1c",
            "comp1": 93.2,
            "currMeterRealPaymentMoney": 130.0,
            "fromAccount": 0.0,
            "operator": "\u97e9\u9759",
            "userPayingRecordID": 44842,
            "effluentBillStatus": 1,
            "realWaterFee": 96.0,
            "realPay": 130.0,
            "waterBillStatus": 1,
            "ladderFee": 0.0,
            "realLateFee": 0.0,
            "realPaymentMoney": 130.0,
            "billFee": 96.0,
            "other": "\u627e\u96f6\u8f6c\u5165\u9884\u5b58",
            "payMoney": 130.0,
            "meterPayingRecordStatus": 1,
            "meterID": 14397,
            "currGiveChange": 0.0,
            "effluentFee": 34.0,
            "currMeterRealPaymentMoneyOld": 130.0,
            "lrid": "",
            "realTax": 0.0,
            "inputer": "\u97e9\u9759",
            "meterLastSurplus": 0.0,
            "waterRateID": 1,
            "meterReadingRecordID": 52612,
            "realWaterCount": 40,
            "meterCurrSurplus": 0.0,
            "cashierName": "\u97e9\u9759",
            "costTypeName": "\u73b0\u91d1",
            "totalBillFee": 130.0,
            "payTime": "2023-09-26 17:30:40",
            "currReadingValue": 40,
            "currWaterCount": 40,
            "realOtherFee": 0.0,
            "billAndTax": 96.0,
            "name": "\u8def\u94f6\u864e",
            "currMeterRealPaymentMoenyWithoutSurplus": 130.0,
            "volumeID": 154,
            "lastReadingValue": 0,
            "realEffluentFee": 34.0,
            "currManner": "\u73b0\u91d1",
            "lateDays": 0
          },
          {
            "readerName": "\u51af\u5a1c",
            "oddMoney": 0.0,
            "meterPayingRecordID": 47578,
            "waterFee": 96.0,
            "volumeName": "\u9633\u5174\u5e9c",
            "tax": 0.0,
            "period": "202109",
            "inputTime": "2023-09-26 16:27:05",
            "waterRateName": "\u751f\u6d3b\u7528\u6c34",
            "comp2": 2.8,
            "amounter": "\u51af\u5a1c",
            "comp1": 93.2,
            "currMeterRealPaymentMoney": 130.0,
            "fromAccount": 0.0,
            "operator": "\u519c\u4e1a\u94f6\u884c",
            "userPayingRecordID": 44831,
            "effluentBillStatus": 1,
            "realWaterFee": 96.0,
            "realPay": 130.0,
            "waterBillStatus": 1,
            "ladderFee": 0.0,
            "realLateFee": 0.0,
            "realPaymentMoney": 130.0,
            "billFee": 96.0,
            "other": "\u9884\u5b58\u8f6c\u5165",
            "payMoney": 130.0,
            "meterPayingRecordStatus": 1,
            "meterID": 14631,
            "currGiveChange": 0.0,
            "effluentFee": 34.0,
            "currMeterRealPaymentMoneyOld": 130.0,
            "lrid": "",
            "realTax": 0.0,
            "inputer": "\u97e9\u9759",
            "meterLastSurplus": 0.0,
            "waterRateID": 1,
            "meterReadingRecordID": 52610,
            "realWaterCount": 40,
            "meterCurrSurplus": 0.0,
            "cashierName": "\u519c\u4e1a\u94f6\u884c",
            "costTypeName": "\u5fae\u4fe1\u652f\u4ed8",
            "totalBillFee": 130.0,
            "payTime": "2023-09-26 16:28:43",
            "currReadingValue": 40,
            "currWaterCount": 40,
            "realOtherFee": 0.0,
            "billAndTax": 96.0,
            "name": "\u5218\u5e94\u6587",
            "currMeterRealPaymentMoenyWithoutSurplus": 130.0,
            "volumeID": 154,
            "lastReadingValue": 0,
            "realEffluentFee": 34.0,
            "currManner": "\u5fae\u4fe1\u652f\u4ed8",
            "lateDays": 0
          },
          {
            "readerName": "\u767d\u660e\u5e38",
            "oddMoney": 0.0,
            "meterPayingRecordID": 47577,
            "waterFee": 4.8,
            "volumeName": "\u9ec4\u5174\u8def",
            "tax": 0.0,
            "period": "202109",
            "inputTime": "2023-09-13 15:56:02",
            "waterRateName": "\u5c45\u6c11\u751f\u6d3b\u7528\u6c34",
            "comp2": 0.15,
            "amounter": "\u767d\u660e\u5e38",
            "comp1": 4.85,
            "currMeterRealPaymentMoney": 5.0,
            "fromAccount": 0.0,
            "operator": "\u97e9\u9759",
            "userPayingRecordID": 44830,
            "effluentBillStatus": 1,
            "realWaterFee": 4.8,
            "realPay": 4.8,
            "waterBillStatus": 1,
            "ladderFee": 0.0,
            "realLateFee": 0.0,
            "realPaymentMoney": 5.0,
            "billFee": 5.0,
            "other": "\u627e\u96f6\u8f6c\u5165\u9884\u5b58",
            "payMoney": 5.0,
            "meterPayingRecordStatus": 1,
            "meterID": 10663,
            "currGiveChange": 0.0,
            "effluentFee": 0.0,
            "currMeterRealPaymentMoneyOld": 5.0,
            "lrid": "",
            "realTax": 0.0,
            "inputer": "\u51af\u5a1c",
            "meterLastSurplus": 0.0,
            "waterRateID": 7,
            "meterReadingRecordID": 50198,
            "realWaterCount": 2,
            "meterCurrSurplus": 0.2,
            "cashierName": "\u97e9\u9759",
            "costTypeName": "\u73b0\u91d1",
            "totalBillFee": 5.0,
            "payTime": "2023-09-26 16:23:37",
            "currReadingValue": 48,
            "currWaterCount": 2,
            "realOtherFee": 0.0,
            "billAndTax": 5.0,
            "name": "\u667a\u7c89\u5a25",
            "currMeterRealPaymentMoenyWithoutSurplus": 4.8,
            "volumeID": 85,
            "lastReadingValue": 46,
            "realEffluentFee": 0.0,
            "currManner": "\u73b0\u91d1",
            "lateDays": 0
          },
          {
            "readerName": "\u51af\u5a1c",
            "oddMoney": 0.0,
            "meterPayingRecordID": 47576,
            "waterFee": 96.0,
            "volumeName": "\u9633\u5174\u5e9c",
            "tax": 0.0,
            "period": "202109",
            "inputTime": "2023-09-26 16:17:24",
            "waterRateName": "\u751f\u6d3b\u7528\u6c34",
            "comp2": 2.8,
            "amounter": "\u51af\u5a1c",
            "comp1": 93.2,
            "currMeterRealPaymentMoney": 130.0,
            "fromAccount": 0.0,
            "operator": "\u519c\u4e1a\u94f6\u884c",
            "userPayingRecordID": 44829,
            "effluentBillStatus": 1,
            "realWaterFee": 96.0,
            "realPay": 130.0,
            "waterBillStatus": 1,
            "ladderFee": 0.0,
            "realLateFee": 0.0,
            "realPaymentMoney": 130.0,
            "billFee": 96.0,
            "other": "\u9884\u5b58\u8f6c\u5165",
            "payMoney": 130.0,
            "meterPayingRecordStatus": 1,
            "meterID": 14292,
            "currGiveChange": 0.0,
            "effluentFee": 34.0,
            "currMeterRealPaymentMoneyOld": 130.0,
            "lrid": "",
            "realTax": 0.0,
            "inputer": "\u97e9\u9759",
            "meterLastSurplus": 0.0,
            "waterRateID": 1,
            "meterReadingRecordID": 52609,
            "realWaterCount": 40,
            "meterCurrSurplus": 0.0,
            "cashierName": "\u519c\u4e1a\u94f6\u884c",
            "costTypeName": "\u5fae\u4fe1\u652f\u4ed8",
            "totalBillFee": 130.0,
            "payTime": "2023-09-26 16:18:38",
            "currReadingValue": 40,
            "currWaterCount": 40,
            "realOtherFee": 0.0,
            "billAndTax": 96.0,
            "name": "\u8d3e\u5c0f\u71d5",
            "currMeterRealPaymentMoenyWithoutSurplus": 130.0,
            "volumeID": 154,
            "lastReadingValue": 0,
            "realEffluentFee": 34.0,
            "currManner": "\u5fae\u4fe1\u652f\u4ed8",
            "lateDays": 0
          },
          {
            "readerName": "\u5434\u6625\u5fb7",
            "oddMoney": 0.0,
            "meterPayingRecordID": 47575,
            "waterFee": 38.4,
            "volumeName": "\u5bcc\u5eb7\u5bb6\u56ed",
            "tax": 0.0,
            "period": "202109",
            "inputTime": "2023-09-23 11:09:57",
            "waterRateName": "\u751f\u6d3b\u7528\u6c34",
            "comp2": 1.12,
            "amounter": "\u5434\u6625\u5fb7",
            "comp1": 37.28,
            "currMeterRealPaymentMoney": 52.0,
            "fromAccount": 0.0,
            "operator": "\u519c\u4e1a\u94f6\u884c",
            "userPayingRecordID": 44828,
            "effluentBillStatus": 1,
            "realWaterFee": 38.4,
            "realPay": 52.0,
            "waterBillStatus": 1,
            "ladderFee": 0.0,
            "realLateFee": 0.0,
            "realPaymentMoney": 52.0,
            "billFee": 38.4,
            "other": "\u9884\u5b58\u8f6c\u5165",
            "payMoney": 52.0,
            "meterPayingRecordStatus": 1,
            "meterID": 9619,
            "currGiveChange": 0.0,
            "effluentFee": 13.6,
            "currMeterRealPaymentMoneyOld": 52.0,
            "lrid": "",
            "realTax": 0.0,
            "inputer": "\u51af\u5a1c",
            "meterLastSurplus": 0.0,
            "waterRateID": 1,
            "meterReadingRecordID": 52168,
            "realWaterCount": 16,
            "meterCurrSurplus": 0.0,
            "cashierName": "\u519c\u4e1a\u94f6\u884c",
            "costTypeName": "\u5fae\u4fe1\u652f\u4ed8",
            "totalBillFee": 52.0,
            "payTime": "2023-09-26 16:12:14",
            "currReadingValue": 745,
            "currWaterCount": 16,
            "realOtherFee": 0.0,
            "billAndTax": 38.4,
            "name": "\u5f20\u7ee7\u56fd",
            "currMeterRealPaymentMoenyWithoutSurplus": 52.0,
            "volumeID": 42,
            "lastReadingValue": 729,
            "realEffluentFee": 13.6,
            "currManner": "\u5fae\u4fe1\u652f\u4ed8",
            "lateDays": 0
          },
          {
            "readerName": "\u7530\u5efa\u529f",
            "oddMoney": 0.0,
            "meterPayingRecordID": 47574,
            "waterFee": 204.0,
            "volumeName": "\u5de5\u5546\u6237",
            "tax": 35.7,
            "period": "202105",
            "inputTime": "2023-05-25 11:50:47",
            "waterRateName": "\u975e\u5c45\u6c11\u7528\u6c34",
            "comp2": 5.94,
            "amounter": "\u7530\u5efa\u529f",
            "comp1": 198.06,
            "currMeterRealPaymentMoney": 300.9,
            "fromAccount": 0.0,
            "operator": "\u519c\u4e1a\u94f6\u884c",
            "userPayingRecordID": 44827,
            "effluentBillStatus": 1,
            "realWaterFee": 204.0,
            "realPay": 300.9,
            "waterBillStatus": 1,
            "ladderFee": 0.0,
            "realLateFee": 0.0,
            "realPaymentMoney": 300.9,
            "billFee": 204.0,
            "other": "\u9884\u5b58\u8f6c\u5165",
            "payMoney": 300.9,
            "meterPayingRecordStatus": 1,
            "meterID": 1684,
            "currGiveChange": 0.0,
            "effluentFee": 61.2,
            "currMeterRealPaymentMoneyOld": 300.9,
            "lrid": "",
            "realTax": 35.7,
            "inputer": "\u9a6c\u5c0f\u6614",
            "meterLastSurplus": 0.0,
            "waterRateID": 6,
            "meterReadingRecordID": 37460,
            "realWaterCount": 51,
            "meterCurrSurplus": 0.0,
            "cashierName": "\u519c\u4e1a\u94f6\u884c",
            "costTypeName": "\u5fae\u4fe1\u652f\u4ed8",
            "totalBillFee": 300.9,
            "payTime": "2023-09-26 16:10:38",
            "currReadingValue": 579,
            "currWaterCount": 51,
            "realOtherFee": 0.0,
            "billAndTax": 239.7,
            "name": "\u5b59\u671d\u9633",
            "currMeterRealPaymentMoenyWithoutSurplus": 300.9,
            "volumeID": 3,
            "lastReadingValue": 528,
            "realEffluentFee": 61.2,
            "currManner": "\u5fae\u4fe1\u652f\u4ed8",
            "lateDays": 0
          }
        ];
        self.tablePagination.total = 10;
        //   } else {
        //     self.$message.error(res.data.res);
        //   }
        // });
      },
      pageSizeChange(data) {
        this.tablePagination.size = data;
        this.handleTableData();
      },
      currentPageChange(data) {
        this.tablePagination.current = data;
        this.handleTableData();
      },
      getTableAllData(text) {
        var self = this;
        self.$axios
          .post("/service/bsMeterPayingReceiptInfoAllGet", self.searchAllParam)
          .then(res => {
            if (res.data.status === "success") {
              if (text == 'export') {
                self.$refs.child.exportAllToExcel(res.data.res);
              } else if (text == 'print') {
                self.$refs.child.printAllData(res.data.res);
              }
            } else {
              self.$message.error(res.data.res);
            }
          });
      },
      handlePageOperation(row, mark) {
        const self = this;
        // bsMeterPayingReceiptInfoGetZ         参数  meterPayingRecordID           获取票据信息的接口，用于补打发票
        if (mark === "waterBill") {
          //获取水费的数据
          var billPparam = {
            meterPayingReceiptInfoID: row.meterPayingReceiptInfoID
          };
          self.$axios
            .post("/service/bsMeterPayingReceiptInfoGetZ", billPparam)
            .then(res => {
              if (res.data.status === "success") {
                self.receipt_data = res.data.res;
                self.WPrintWaitLoop();
              } else {
                self.$message.error(res.data.res);
              }
            });
        } else if (mark === "sewageBill") {
          //获取污水票据的数据
          var billPparam = {
            meterPayingReceiptInfoID: row.meterPayingReceiptInfoID
          };
          self.$axios
            .post("/service/bsMeterPayingReceiptInfoGetZ", billPparam)
            .then(res => {
              if (res.data.status === "success") {
                self.receipt_data = res.data.res;
                self.SWPrintWaitLoop();
              } else {
                self.$message.error(res.data.res);
              }
            });
        }
      },
      //打印方法
      // 水费票据打印
      WPrintWaitLoop() {
        const self = this;
        LODOP = getLodop();
        LODOP.PRINT_INITA("-5mm", "-10mm", "190mm", "102mm", "水费");
        LODOP.SET_PRINT_PAGESIZE(1, "190mm", "102mm", "");
        self.AddWPrintContent(self.receipt_data);
        // LODOP.PRINT();
        LODOP.PREVIEW();
      },
      // 污水费票据打印
      SWPrintWaitLoop() {
        const self = this;
        LODOP = getLodop();
        LODOP.PRINT_INITA("-5mm", "-10mm", "240mm", "76mm", "污水费");
        LODOP.SET_PRINT_PAGESIZE(1, 0, "76mm", "A3");
        self.AddSWPrintContent(self.receipt_data);
        // LODOP.PRINT();
        LODOP.PREVIEW();
      },
      // 水费票据内容
      AddWPrintContent(WreceiptData) {
        const self = this;
        LODOP.SET_PRINT_STYLE("FontName", "微软雅黑");
        LODOP.SET_PRINT_STYLE("FontSize", 11);
        LODOP.ADD_PRINT_TEXT("20mm", "40mm", "30mm", "6mm", WreceiptData.payTime.split(" ")[0]);
        LODOP.ADD_PRINT_TEXT("30mm", "20mm", "20mm", "8mm", "用户编号");
        LODOP.ADD_PRINT_TEXT(
          "30mm",
          "37mm",
          "33mm",
          "8mm",
          "：" + WreceiptData.meterID
        );
        LODOP.ADD_PRINT_TEXT("30mm", "70mm", "20mm", "8mm", "用户姓名");
        LODOP.ADD_PRINT_TEXT(
          "30mm",
          "87mm",
          "33mm",
          "8mm",
          "：" + WreceiptData.meterUserName
        );
        LODOP.ADD_PRINT_TEXT("30mm", "120mm", "23mm", "8mm", "抄表员");
        LODOP.ADD_PRINT_TEXT(
          "30mm",
          "140mm",
          "30mm",
          "8mm",
          "：" + WreceiptData.readerName
        );
        LODOP.ADD_PRINT_TEXT("38mm", "20mm", "20mm", "8mm", "用户地址");
        LODOP.ADD_PRINT_TEXT(
          "38mm",
          "37mm",
          "83mm",
          "8mm",
          "：" + WreceiptData.villageName + WreceiptData.villageDetail
        );
        LODOP.ADD_PRINT_TEXT("38mm", "120mm", "23mm", "8mm", "用水月份");
        LODOP.ADD_PRINT_TEXT(
          "38mm",
          "140mm",
          "30mm",
          "8mm",
          "：" + WreceiptData.period
        );
        LODOP.ADD_PRINT_TEXT("46mm", "20mm", "20mm", "8mm", "上期指数");
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "37mm",
          "33mm",
          "8mm",
          "：" + WreceiptData.lastReadingValue
        );
        LODOP.ADD_PRINT_TEXT("46mm", "70mm", "20mm", "8mm", "本期指数");
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "87mm",
          "33mm",
          "8mm",
          "：" + WreceiptData.currReadingValue
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "120mm",
          "23mm",
          "8mm",
          WreceiptData.waterRateName
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "140mm",
          "30mm",
          "8mm",
          "：" + WreceiptData.currWaterFee
        );
        LODOP.ADD_PRINT_TEXT("54mm", "20mm", "20mm", "8mm", "抵扣水量");
        LODOP.ADD_PRINT_TEXT(
          "54mm",
          "37mm",
          "33mm",
          "8mm",
          "：" + WreceiptData.readingFromDepositWater
        );
        LODOP.ADD_PRINT_TEXT("54mm", "70mm", "20mm", "8mm", "用水量");
        LODOP.ADD_PRINT_TEXT(
          "54mm",
          "87mm",
          "33mm",
          "8mm",
          "：" + WreceiptData.currWaterCount
        );
        LODOP.ADD_PRINT_TEXT("54mm", "120mm", "23mm", "8mm", "滞纳天数");
        LODOP.ADD_PRINT_TEXT(
          "54mm",
          "140mm",
          "30mm",
          "8mm",
          "：" + WreceiptData.lateDays
        );
        LODOP.ADD_PRINT_TEXT("62mm", "20mm", "20mm", "8mm", "预存水费");
        LODOP.ADD_PRINT_TEXT(
          "62mm",
          "37mm",
          "33mm",
          "8mm",
          "：" + WreceiptData.currDepositWaterMoney
        );
        LODOP.ADD_PRINT_TEXT("62mm", "70mm", "20mm", "8mm", "水费");
        LODOP.ADD_PRINT_TEXT(
          "62mm",
          "87mm",
          "33mm",
          "8mm",
          "：" + WreceiptData.realWaterFee
        );
        LODOP.ADD_PRINT_TEXT("62mm", "120mm", "23mm", "8mm", "滞纳金");
        LODOP.ADD_PRINT_TEXT(
          "62mm",
          "140mm",
          "30mm",
          "8mm",
          "：" + WreceiptData.realLateFee
        );
        LODOP.ADD_PRINT_TEXT("70mm", "20mm", "20mm", "8mm", "上次结余");
        LODOP.ADD_PRINT_TEXT(
          "70mm",
          "37mm",
          "33mm",
          "8mm",
          "：" + WreceiptData.lastSurplus
        );
        LODOP.ADD_PRINT_TEXT("70mm", "70mm", "20mm", "8mm", "本次结余");
        LODOP.ADD_PRINT_TEXT(
          "70mm",
          "87mm",
          "33mm",
          "8mm",
          "：" + WreceiptData.currSurplus
        );
        LODOP.ADD_PRINT_TEXT("70mm", "120mm", "23mm", "8mm", "总计金额");
        LODOP.ADD_PRINT_TEXT(
          "70mm",
          "140mm",
          "30mm",
          "8mm",
          "：" + WreceiptData.receiptTotalFee
        );
        LODOP.ADD_PRINT_TEXT("78mm", "20mm", "33mm", "8mm", "总计金额大写：");
        LODOP.ADD_PRINT_TEXT(
          "78mm",
          "50mm",
          "117mm",
          "8mm",
          self.convertCurrency(WreceiptData.receiptTotalFee)
        );
        LODOP.ADD_PRINT_TEXT(
          "94mm",
          "149mm",
          "20mm",
          "6mm",
          WreceiptData.cashier
        );
      },
      // 污水费票据内容
      AddSWPrintContent(SWreceiptData) {
        const self = this;
        LODOP.SET_PRINT_STYLE("FontName", "微软雅黑");
        LODOP.SET_PRINT_STYLE("FontSize", 11);
        //污水票上面的时间
        var payingTime = SWreceiptData.payTime.split(" ");
        var top_data_str = payingTime[0].split("-");
        var top_data_year = top_data_str[0];
        var top_data_month = top_data_str[1];
        var top_data_day = top_data_str[2];
        LODOP.ADD_PRINT_TEXT("21mm", "83mm", "13mm", "6mm", top_data_year);
        LODOP.ADD_PRINT_TEXT("21mm", "100mm", "8mm", "6mm", top_data_month);
        LODOP.ADD_PRINT_TEXT("21mm", "109mm", "8mm", "6mm", top_data_day);
        LODOP.ADD_PRINT_TEXT(
          "29mm",
          "22mm",
          "44mm",
          "8mm",
          SWreceiptData.meterUserName
        );
        LODOP.ADD_PRINT_TEXT(
          "29mm",
          "76mm",
          "40mm",
          "8mm",
          SWreceiptData.villageName + SWreceiptData.villageDetail
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "22mm",
          "15mm",
          "10mm",
          SWreceiptData.currReadingValue
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "40mm",
          "20mm",
          "10mm",
          SWreceiptData.waterRateName
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "60mm",
          "13mm",
          "10mm",
          SWreceiptData.currEffluentFee
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "78mm",
          "15mm",
          "10mm",
          SWreceiptData.otherCurrWaterCount
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "100mm",
          "15mm",
          "10mm",
          SWreceiptData.effluentFee
        );
        LODOP.ADD_PRINT_TEXT(
          "58mm",
          "25mm",
          "90mm",
          "8mm",
          self.convertCurrency(SWreceiptData.effluentFee)
        );
        LODOP.ADD_PRINT_TEXT(
          "66mm",
          "35mm",
          "20mm",
          "6mm",
          SWreceiptData.cashier
        );
        LODOP.ADD_PRINT_TEXT("66mm", "93mm", "25mm", "6mm", payingTime[0]);

        LODOP.ADD_PRINT_TEXT("21mm", "193mm", "13mm", "6mm", top_data_year);
        LODOP.ADD_PRINT_TEXT("21mm", "210mm", "8mm", "6mm", top_data_month);
        LODOP.ADD_PRINT_TEXT("21mm", "219mm", "8mm", "6mm", top_data_day);
        LODOP.ADD_PRINT_TEXT(
          "29mm",
          "132mm",
          "44mm",
          "8mm",
          SWreceiptData.meterUserName
        );
        LODOP.ADD_PRINT_TEXT(
          "29mm",
          "186mm",
          "40mm",
          "8mm",
          SWreceiptData.villageName + SWreceiptData.villageDetail
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "132mm",
          "15mm",
          "10mm",
          SWreceiptData.currReadingValue
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "150mm",
          "20mm",
          "10mm",
          SWreceiptData.waterRateName
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "170mm",
          "13mm",
          "10mm",
          SWreceiptData.currEffluentFee
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "188mm",
          "15mm",
          "10mm",
          SWreceiptData.otherCurrWaterCount
        );
        LODOP.ADD_PRINT_TEXT(
          "46mm",
          "210mm",
          "15mm",
          "10mm",
          SWreceiptData.effluentFee
        );
        LODOP.ADD_PRINT_TEXT(
          "58mm",
          "135mm",
          "90mm",
          "8mm",
          self.convertCurrency(SWreceiptData.effluentFee)
        );
        LODOP.ADD_PRINT_TEXT(
          "66mm",
          "145mm",
          "20mm",
          "6mm",
          SWreceiptData.cashier
        );
        LODOP.ADD_PRINT_TEXT("66mm", "203mm", "25mm", "6mm", payingTime[0]);
      },
      // 兑换货币，小写转大写
      convertCurrency(money) {
        //汉字的数字
        var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
        //基本单位
        var cnIntRadice = new Array('', '拾', '佰', '仟');
        //对应整数部分扩展单位
        var cnIntUnits = new Array('', '万', '亿', '兆');
        //对应小数部分单位
        var cnDecUnits = new Array('角', '分', '毫', '厘');
        //整数金额时后面跟的字符
        var cnInteger = '整';
        //整型完以后的单位
        var cnIntLast = '元';
        //最大处理的数字
        var maxNum = 999999999999999.9999;
        //金额整数部分
        var integerNum;
        //金额小数部分
        var decimalNum;
        //输出的中文金额字符串
        var chineseStr = '';
        //分离金额后用的数组，预定义
        var parts;
        if (money == '') {
          return '';
        }
        money = parseFloat(money);
        if (money >= maxNum) {
          //超出最大处理数字
          return '';
        }
        if (money == 0) {
          chineseStr = cnNums[0] + cnIntLast + cnInteger;
          return chineseStr;
        }
        //转换为字符串
        money = money.toString();
        if (money.indexOf('-') == 0) {
          chineseStr = '（负数）'
          money = money.substr(1)
        }
        if (money.indexOf('.') == -1) {
          integerNum = money;
          decimalNum = '';
        } else {
          parts = money.split('.');
          integerNum = parts[0];
          decimalNum = parts[1].substr(0, 4);
        }
        //获取整型部分转换
        if (parseInt(integerNum, 10) > 0) {
          var zeroCount = 0;
          var IntLen = integerNum.length;
          for (var i = 0; i < IntLen; i++) {
            var n = integerNum.substr(i, 1);
            var p = IntLen - i - 1;
            var q = p / 4;
            var m = p % 4;
            if (n == '0') {
              zeroCount++;
            } else {
              if (zeroCount > 0) {
                chineseStr += cnNums[0];
              }
              //归零
              zeroCount = 0;
              chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
            }
            if (m == 0 && zeroCount < 4) {
              chineseStr += cnIntUnits[q];
            }
          }
          chineseStr += cnIntLast;
        }
        //小数部分
        if (decimalNum != '') {
          var decLen = decimalNum.length;
          for (var i = 0; i < decLen; i++) {
            var n = decimalNum.substr(i, 1);
            if (n != '0') {
              chineseStr += cnNums[Number(n)] + cnDecUnits[i];
            }
          }
        }
        if (chineseStr == '') {
          chineseStr += cnNums[0] + cnIntLast + cnInteger;
        } else if (decimalNum == '') {
          chineseStr += cnInteger;
        }
        return chineseStr;
      }
    }
  };
</script>
<style lang="scss" scoped>
</style>